#!/usr/bint/python3
# coding: utf-8
# models.py
# 2018-07-11
from .ext import db
from datetime import datetime


class Items(db.Model):
	__tablename__='items_info'
	id=db.Column(db.Integer,primary_key=True)
	title=db.Column(db.String(80))
	content=db.Column(db.Text)
	timestamp=db.Column(db.DateTime,index=True,default=datetime.utcnow)
	published=db.Column(db.Boolean,index=True,default=False)
	category_id = db.Column(db.Integer)

	@property
	def dict_item(self):
		return{
			'id': self.id,
			'title': self.title,
			'content': self.content,
			'timestamp': self.timestamp,
			'published': self.published,
			'category_id': self.category_id,
		}
